package com.bw.utils;

import lombok.Data;

import java.io.Serializable;

/**
 * @author 军哥
 * @version 1.0
 * @description: 返回值实体类
 * @date 2024/7/19 9:11
 */

@Data
public class R implements Serializable {

    private Integer code;
    private String msg;
    private Object data;

    public static R OK() {
        R r = new R();
        r.setCode(0);
        r.setMsg("操作成功");

        return r;
    }

    public static R OK(Object data) {
        R r = new R();
        r.setCode(0);
        r.setData(data);
        r.setMsg("操作成功");

        return r;
    }

    public static R ERROR(int code, String msg) {
        R r = new R();
        r.setCode(code);
        r.setMsg(msg);

        return r;
    }

}
